//
// Created by jsjxsy on 2022/8/17.
//
#include <iostream>
#include <cstdio>
using namespace std;
class Base {
 public:
  virtual ~Base() {
    cout << "~Base()" << endl;
  }
  virtual void say() {
    cout << "this is base class" << endl;
  }
};

const class Derived : public Base {
 public:
  void say() {
    cout << "this is Derived class" << endl;
  }
  ~Derived() {
    cout << "~Derived()" << endl;
  }

};
int main() {
  Base *bp;
  bp = new Derived();
  Derived *dp = new Derived();
  if (typeid(*bp) == typeid(*dp)) {
    cout << "dp == bp" << endl;
  } else {
    cout << "dp != bp" << endl;
  }

  Base *bp1 = new Base();
  if (typeid(*bp1) == typeid(*dp)) {
    cout << "dp == bp1" << endl;
  } else {
    cout << "dp != bp1" << endl;
  }
  if (typeid(bp) == typeid(Derived)) {
    cout << "bp pointer != Derived class" << endl;
  }

  return 0;
}